package com.yingside.exception;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数字");
        int a = scanner.nextInt();
        System.out.println("请输入第二个数字");
        int b = scanner.nextInt();
        int c = 0;
        try{
            c = a / b;
            System.out.println("c=" + c);
        } catch(ArithmeticException e){
            System.out.println("计算错误！除数不能为0的异常...");
            c = -1;
        }



    }
}
